﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    EnableEventValidation="false" CodeBehind="ManageProduct.aspx.cs" Inherits="WXYW.ManageProduct" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="Ajax" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitlePlaceHolder" runat="server">
    管理产品信息
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ButtonPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="RightContentPlaceHolder" runat="server">
    <asp:GridView ID="mainGridView" runat="server" AutoGenerateColumns="False" AllowPaging="True"
        PageSize="20" OnRowDataBound="mainGridView_RowDataBound" CssClass="tableList"
        Width="100%" OnRowCommand="mainGridView_RowCommand" OnPageIndexChanged="mainGridView_PageIndexChanged"
        OnPageIndexChanging="mainGridView_PageIndexChanging">
        <Columns>
            <asp:TemplateField HeaderImageUrl="~/image/operateicon/button_Select.gif">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="IDLbl" runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField HeaderText="物料号" DataField="MaterialID" ReadOnly="True">
                <HeaderStyle Wrap="False" />
                <ItemStyle HorizontalAlign="Left" Wrap="False" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="产品型号">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("ModelNumber") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Wrap="False" />
                <ItemStyle HorizontalAlign="Left" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="版本号">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%#Eval("VersionNumber") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Wrap="False" />
                <ItemStyle HorizontalAlign="Left" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="产品类型">
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%#Eval("ProductClass.Name") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Wrap="False" />
                <ItemStyle HorizontalAlign="Left" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="保修期（月">
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%#Eval("RepairPeriod") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="productRepairPeriodTextBox" runat="server" Text='<%#Bind("RepairPeriod") %>'></asp:TextBox>
                </EditItemTemplate>
                <HeaderStyle Wrap="False" />
                <ItemStyle Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="代理商">
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" Text='<%#Eval("Provider.ProviderName") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="providerDropdownList" runat="server" AppendDataBoundItems="True"
                        AutoPostBack="false" DataTextField="ProviderName" DataValueField="ProviderID">
                    </asp:DropDownList>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="产品属性">
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" Text='<%#Eval("Property") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="propertyDropdownList" runat="server" AppendDataBoundItems="True"
                        AutoPostBack="false" SelectedValue='<%# Bind("Property") %>'>
                        <asp:ListItem Text="自研" Value="自研"></asp:ListItem>
                        <asp:ListItem Text="非自研" Value="非自研"></asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
                <HeaderStyle Wrap="False" />
                <ItemStyle HorizontalAlign="Left" Wrap="False" />
            </asp:TemplateField>
            <asp:BoundField DataField="RepairTimes" HeaderText="维修次数" ReadOnly="True"></asp:BoundField>
            <asp:TemplateField HeaderText="操作" ShowHeader="False">
                <ItemTemplate>
                    <img src="image/operateicon/docedit.gif" alt="" />
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName="LookProduct"
                        Text="修改" CommandArgument='<%#Eval("ProductID") %>'></asp:LinkButton>
                    <img src="image/operateicon/docdelete.gif" alt="" />
                    <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="false" CommandName="DeleteProduct"
                        Text="删除" OnClientClick="return confirm('你确定要删除吗？')" CommandArgument='<%#Eval("ProductID") %>' ></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <HeaderStyle HorizontalAlign="Left" VerticalAlign="Middle" Wrap="False" />
        <PagerTemplate>
            本类记录<span style="color: Red"><%= RecordsNumber%></span>条, <span style="color: Red">20</span>条/页
            当前 <span style="color: Red">
                <%= mainGridView.PageIndex + 1%>/<%= mainGridView.PageCount%></span>页
            <asp:LinkButton CommandName="Page" CommandArgument="First" ID="LinkButton1" runat="server"
                Style="color: blue">首页</asp:LinkButton><asp:LinkButton CommandName="Page" CommandArgument="Prev"
                    ID="LinkButton2" runat="server" Style="color: blue">|上一页</asp:LinkButton>
            <asp:LinkButton CommandName="Page" CommandArgument="Next" ID="LinkButton3" runat="server"
                Style="color: blue">下一页</asp:LinkButton><asp:LinkButton CommandName="Page" CommandArgument="Last"
                    ID="LinkButton4" runat="server" Style="color: blue">|尾页</asp:LinkButton>
            转到<asp:DropDownList ID="pageDDL" runat="server" AutoPostBack="True" OnSelectedIndexChanged="pageDDL_SelectedIndexChanged">
            </asp:DropDownList>
        </PagerTemplate>
        <HeaderStyle ForeColor="White" Font-Bold="True" BackColor="#A55129"></HeaderStyle>
    </asp:GridView>
    <asp:Button runat="server" ID="hiddenTargetControlForModalPopup" Style="display: none" />
    <Ajax:ModalPopupExtender ID="modifyPopupExtender" runat="server" PopupControlID="quetationPanel"
        BackgroundCssClass="modalBackground" TargetControlID="hiddenTargetControlForModalPopup"
        Drag="true" PopupDragHandleControlID="QuatationDragBar" CancelControlID="cancelLinkButton">
    </Ajax:ModalPopupExtender>
    <asp:Panel ID="quetationPanel" Style="display: none" runat="server" BackImageUrl="~/image/mainSkinBG.gif"
        CssClass="modalPopup" Width="600px">
        <!-- Header -->
        <div class="box-header" id="QuatationDragBar">
            <img src="image/stdBox_left_top.gif" alt="" />
            <h2>
                维修报价</h2>
        </div>
        <div class="functionPanel">
             <table cellpadding="0px" cellspacing="0px" style="width: 100%">
        <tr>
            <td style="background-color: #f5f5f5; width: 20px;">
            </td>
            <td style="background-color: #ffffff;">
                <table width="100%">
                    <tr style="height: 30px">
                        <td style="width: 100px">
                            物料号:
                        </td>
                        <td style="width: 200px">
                            <asp:TextBox ID="MaterialNOTxtBox" runat="server" Width="200px"></asp:TextBox>
                        </td>
                        <td style="width: 10px">
                            
                        </td>
                        <td style="width: 100px">
                            产品型号:
                        </td>
                        <td style="width: 200px">
                            <asp:TextBox ID="ModelNOTxtBox" runat="server" Width="200px"></asp:TextBox>
                        </td>
                        <td style="width: 10px">
                            <asp:RequiredFieldValidator ID="ModelNORequiredValidator" runat="server" ErrorMessage="请输入产品型号；"
                                Text="*" ControlToValidate="ModelNOTxtBox" ValidationGroup="NewProductValidation"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr style="height: 30px">
                        <td style="width: 100px">
                            版本号:
                        </td>
                        <td style="width: 200px">
                            <asp:TextBox ID="VersionNOTxtBox" runat="server" Width="200px"></asp:TextBox>
                        </td>
                        <td style="width: 10px">
                        </td>
                        <td style="width: 100px">
                            产品类型:
                        </td>
                        <td style="width: 200px">
                            <asp:DropDownList ID="ProductTypeDropdownList" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                        <td style="width: 10px">
                        </td>
                    </tr>
                    <tr style="height: 30px">
                        <td style="width: 100px">
                            产品属性:
                        </td>
                        <td style="width: 200px">
                            <asp:DropDownList ID="PropertyDropdownList" runat="server" Width="200px">
                                <asp:ListItem Text="自研" Value="自研"></asp:ListItem>
                                <asp:ListItem Text="非自研" Value="非自研"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td style="width: 10px">
                        </td>
                        <td style="width: 100px">
                            代理商:
                        </td>
                        <td style="width: 200px">
                            <asp:DropDownList ID="ProviderDropdownList" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                        <td style="width: 10px">
                        </td>
                    </tr>
                    <tr style="height: 30px">
                        <td style="width: 100px">
                            保修期限(月):
                        </td>
                        <td style="width: 200px">
                            <asp:TextBox ID="RepairPeriodTxtBox" runat="server" Width="200px"></asp:TextBox>
                        </td>
                        <td style="width: 10px">
                            <asp:RequiredFieldValidator ID="RepairPeriodRequiredFieldValidator" runat="server" ErrorMessage="请输入保修期限；"
                                Text="*" ControlToValidate="RepairPeriodTxtBox" ValidationGroup="NewProductValidation"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RepairPeriodFormatValidator2" runat="server" ErrorMessage="请输入保修期限；"
                            Text="*" ValidationExpression="^[0-9]+$" ControlToValidate="RepairPeriodTxtBox" ValidationGroup="NewProductValidation"></asp:RegularExpressionValidator>
                        </td>
                        <td style="width: 100px">
                            产品描述:
                        </td>
                        <td style="width: 200px">
                            <asp:TextBox ID="DescriptionTxtBox" runat="server" Width="200px"></asp:TextBox>
                        </td>
                        <td style="width: 10px">
                        </td>
                    </tr>                    
                    <tr>
                        <td colspan="6">
                            <asp:Label ID="MsgLbl" runat="server" ForeColor="Red"></asp:Label>
                             <asp:ValidationSummary ID="ValidationSummary" runat="server" EnableClientScript="true"
                                DisplayMode="BulletList" ValidationGroup="NewProductValidation" />
                        </td>
                    </tr>
                </table>
            </td>
            <td style="background-color: #f5f5f5; width: 20px;">
            </td>
        </tr>
    </table>
            <div style="text-align: center">
                <img src="image/operateicon/docdelete.gif" alt="" />
                <asp:LinkButton ID="cancelLinkButton" runat="server">关闭</asp:LinkButton>
                <img src="image/operateicon/check.gif" alt="" />
                <asp:LinkButton ID="saveLinkButton" runat="server" OnClick="saveLinkButton_Click">保存</asp:LinkButton>
            </div>
        </div>
        <div class="box-footer">
            <img alt="" src="image/stdBox_left_bottom.gif" />
            <p>
                &nbsp;</p>
        </div>
    </asp:Panel>
    <asp:HiddenField ID="hfProductID" runat="server" />
</asp:Content>
